package com.bite.ioc;

import com.bite.ioc.controller.HelloController;
import com.bite.ioc.controller.UserController;
import com.bite.ioc.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

//@ComponentScan(basePackages = "com.bite.ioc")
@SpringBootApplication
public class DemoApplication {

	public static void main(String[] args) {
		ApplicationContext context = SpringApplication.run(DemoApplication.class, args);

		UserController bean = context.getBean(UserController.class);
		bean.sayHi();

//		UserController usercon = (UserController) context.getBean("usercon");
//		usercon.sayHi();

//		HelloController bean = context.getBean(HelloController.class);
//		System.out.println(bean);
//		bean.sayHi();
//
//		HelloController helloController = (HelloController) context.getBean("helloController");
//		System.out.println(helloController);
//		helloController.sayHi();
//
//		HelloController helloController1 = context.getBean("helloController", HelloController.class);
//		System.out.println(helloController1);
//		helloController1.sayHi();

//		UController bean = context.getBean(UController.class);
//		bean.sayHi();
//
//		UController uController = (UController) context.getBean("UController");
//		uController.sayHi();
//
//		UController uc = context.getBean("UController", UController.class);
//		uc.sayHi();
//
//		System.out.println(Introspector.decapitalize("HelloController"));
//		System.out.println(Introspector.decapitalize("UController"));

//		UserService bean2 = context.getBean(UserService.class);
//		bean2.doService();
//		UserComponent bean1 = context.getBean(UserComponent.class);
//		bean1.doComponent();
//		UserConfig bean2 = context.getBean(UserConfig.class);
//		bean2.doConfig();
//		UserRepo bean3 = context.getBean(UserRepo.class);
//		bean3.doRepo();
//
//		UserInfo bean = (UserInfo) context.getBean("UCInfo");
//		System.out.println(bean);

	}

}
